Marc Pouget and Frédéric Cazals
This chapter describes the Cgal package for the approximating the ridges and umbilics of a smooth surface discretized by a triangle mesh. Given a smooth surface, a ridge is a curve along which one of the principal curvatures has an extremum along its curvature line. An umbilic is a point at which both principal curvatures are equal. Ridges define a singular curve, i.e., a self-intersecting curve, and umbilics are special points on this curve. Ridges are curves of extremal curvature and therefore encode important informations used in segmentation, registration, matching and surface analysis. Based on the results of the article [CP05c], we propose algorithms to identify and extract different parts of this singular ridge curve as well as umbilics on a surface given as a triangulated surface mesh. Differential quantities associated to the mesh vertices are assumed to be given for these algorithms; such quantities may be computed by the package Estimation of Local Differential Properties of Sampled Surfaces via Polynomial Fitting.
Note that this package needs the third party library Eigenfor linear algebra operations.
Section 56.1 presents the basics of the theory of ridges and umbilics on smooth surfaces. Sections 56.2 and 56.3 present algorithms for approximating the ridges and umbilics (of a smooth surface) from a triangle mesh. Section 56.4 gives the package specifications, while example calls to functions of the package are provided in Section 56.5.
For a detailed introduction to ridges and related topics, the reader may consult [HGY+99, Por01], as well as the following survey article [CP05b]. In the sequel, we just introduce the basic notions so as to explain our algorithms. Consider a smooth embedded surface, and denote k1 and k2 the principal curvatures, with k1 ≥ k2. Umbilics are the points where k1=k2. For any non umbilical point, the corresponding principal directions of curvature are well defined, and we denote them d1 and d2. In local coordinates, we denote 〈, 〉 the inner product induced by the ambient Euclidean space, and dk1, dk2 the gradients of the principal curvatures. Ridges, illustrated in Figure 56.2 for the standard ellipsoid, are defined by:
Definition.
A non umbilical point is called
The previous characterization of ridges involves third-order differential properties. Using fourth-order differential quantities, a ridge point can further be qualified as elliptic if it corresponds to a maximum of k1 or a minimum of k2, or hyperbolic otherwise. Hence we end up with four types of ridges, namely: MAX_ELLIPTIC_RIDGE, MAX_HYPERBOLIC_RIDGE, MIN_ELLIPTIC_RIDGE, MIN_HYPERBOLIC_RIDGE, which are illustrated in Figure 56.2. Also of interest are the crest lines, a crest line being an elliptic ridge which is a maximum of max (|k1|,|k2|). Crest lines form a subset of elliptic ridges, and can be seen as the visually most salient curves on a surface. Hence we provide the two additional ridge types MAX_CREST_RIDGE and MIN_CREST_RIDGE, which are illustrated in Figure 56.
At any point of the surface which is not an umbilic, principal directions d1, d2 are well defined, and these (non oriented) directions together with the normal vector n define two direct orthonormal frames. If v1 is a unit vector of direction d1 then there exists a unique unit vector v2 so that (v1,v2,n) is direct, that is has the same orientation as the canonical basis of the ambient 3d space (and the other possible frame is (-v1,-v2,n)). In the coordinate systems (v1,v2,n), the surface has the following canonical form, known as the Monge form :
|
The Taylor expansion of k1 (resp. k2) along the max (resp. min) curvature line going through the origin and parameterized by x (resp. y) are:
k1(x) = k1 + b0x + |
| x2 +h.o.t, P1= 3b12+(k1-k2)(c0-3k13). |
k2(y) = k2 + b3y + |
| y2 +h.o.t, P2= 3b22+(k2-k1)(c4-3k23). |
Notice also that switching from one to the other of the two
afore-mentioned coordinate systems reverts the sign of all the odd
coefficients on the Monge form of the surface.
Hence ridge types are characterized by
As illustrated in Figures 56.3 and 56.4, the patterns made by curvature lines around an umbilic can be characterized using the notion of an index associated to the principal directions - see also [CP05b]. As depicted in Figure 56.3, consider a small circuit C around the umbilic, and a point p ∈ C. Starting from an initial orientation u of a tangent vector to the curvature line through point p, propagate by continuity this orientation around the circuit. The index is defined by the angle swept by u around this revolution, normalized by 2π. In our example, the index is thus 1/2.
If the index of the principal direction field is 1/2 then it is called a ELLIPTIC_UMBILIC, if it is -1/2 it is called a HYPERBOLIC_UMBILIC. Otherwise the umbilic is qualified NON_GENERIC_UMBILIC.
Our method aims at reporting ridges as polygonal lines living on the mesh. It assumes differential quantities are available for each vertex of the mesh (principal curvatures and directions together with third order quantities b0, b3 and optionally fourth order quantities P1, P2). These differential quantities may be computed for the smooth surface the mesh is inscribed in (analytically or using approximation methods), or may be estimated for a mesh given without reference to an underlying smooth surface. Although the ridge approximation algorithm is the same in both cases, one cannot ambition to ask for the same certificates. This distinction calls for the notion of compliant mesh.
Compliant meshes.
Ridges of a smooth surface are points with prescribed differential
properties, and reporting them from a mesh inscribed in the surface
requires delicate hypothesis on the geometry of that mesh so as to get
a certified result. In this paragraph, we assume the mesh provided
complies with a number of hypothesis, which guarantee the topology of
the ridges reported matches that of the ridges on the smooth
surface. To summarize things, a compliant mesh is a mesh dense enough
so that (i) umbilics are properly isolated (ii) ridges running next
to one another are also properly separated.
See [CP05c] for a detailed discussion of compliant meshes.
As 0-level set of the extremality coefficients b0 and b3, ridges are extracted by a marching triangles algorithm.2
As the signs of these extremality coefficients depend on the orientation of the principal directions, we expect both extremalities and vectors orienting the principal direction to be given at each point vertex of the mesh. Except in the neighborhood of umbilics, if the mesh is dense enough, a coherent orientation of principal directions at both endpoints of an edge is chosen such that the angle between the two vectors is acute. This rule, the acute rule, is precisely analyzed in [CP05c]. Moreover, we only seek ridges in triangles for which one can find an orientation of its three vertices such that the three edges are coherently oriented by the acute rule. Such triangles are called regular. This said, two remarks are in order.
- Regular triangles and ridge segments. A regular triangle has 0 or 2 edges crossed by a max (resp. min) ridge, which is tantamount to a sign change of b0 (resp. b3) along the corresponding edges. In the latter case, we say that the triangle contains a ridge segment. Two methods are provided to compute its type, be it elliptic or hyperbolic. First, if fourth order differential quantities are provided, one can use the P1 (P2) values of Equations 56.2 (56.2) for a max (min) ridge. The value of Pi for a ridge segment is defined as the mean value of the Pi values of the two crossing points on edges (while the value at a crossing point on an edge is the bi-weighted mean value of the values at endpoints). Alternatively, if third order differential quantities only are available, one may use the geometric method developed in [CP05c].
Using the notion of ridge segment, a Ridge_line is defined as a maximal connected sequence of ridge segments of the same type and connected together. Notice that the topology of a Ridge_line is either that of an interval or a circle.
- Non-regular triangles. In the neighborhood of umbilics, triangle are less likely to be regular and the detection of ridges cannot be relevant by this method. This is why we propose another method to detect umbilics independently.
Non compliant meshes: filtering ridges on strength and sharpness. For real world applications dealing with coarse meshes, or meshes featuring degenerate regions or sharp features, or meshes conveying some amount of noise, the compliance hypothesis [CP05c] cannot be met. In that case, it still makes sense to seek loci of points featuring extremality of estimated principal curvatures, but the ridges reported may require filtering. For example, if the principal curvatures are constant - which is the case on a plane or a cylinder, then all points are ridge points. In this context, an appealing notion is that of sharp ridge or prominent ridge. Since ridges are witnessed by zero crossings of b0 and b3, one can expect erroneous detections as long as these coefficients remain small. In order to select the most prominent ridge points, we focus on points where the variation of the curvature is fast along the curvature line. One can observe that, at a ridge point, according to Equation 56.2, the second derivative of k1 along its curvature line satisfies k1''(0) = P1/(k1-k2). Using this observation, one can define the sharpness of a ridge as the integral of the absolute value of P1/(k1-k2) along the ridge. As the second derivative of the curvature is homogeneous to the inverse of the cube of a length, the sharpness is homogeneous to the inverse of the square of a length. Multiplying the sharpness by the square of the model size gives a threshold and an associated sharpness-filter which are scale independent. Another filtering is also available with the strength which is the integral of the curvature along the ridge line [OBS04].
The method aims at identifying some vertices of a mesh as umbilics. It assumes principal curvatures and directions are given at each vertex on the mesh.
Algorithm. Assume each vertex v of the mesh comes with a patch (a topological disk) around it. Checking whether vertex v is an umbilic is a two stages process, which are respectively concerned with the variation of the function k1-k2 over the patch, and the index of the vertex computed from the boundary of the patch. More precisely, vertex v is declared to be an umbilic if the following two conditions are met:
Finding patches around vertices. Given a vertex v and a parameter t, we aim at defining a collection of triangles around v so that (i) this collection defines a topological disk on the triangulation T and (ii) its size depends on t. First we collect the 1-ring triangles. We define the size s of this 1-ring patch as the (Euclidean) distance from v to its farthest 1-ring vertex neighbor. We then collect recursively adjacent triangles so that the patch remains a topological disk and such that these triangles are at distance less than s × t. Parameter t is the only parameter of the algorithm.
Umbilical patches versus ridges. On a generic surface, generic umbilics are traversed by one or three ridges. For compliant meshes, an umbilic can thus be connected to the ridge points located on the boundary of its patch. This functionality is not provided, and the interested reader is referred to [CP05c] for more details.
All classes of this package are templated by the parameter TriangulatedSurfaceMesh, which defines the type of the mesh to which the approximation algorithms operate.
The differential quantities are provided at vertices of this mesh via property maps, a concept commonly used in the Boost library. Scalar data (curvatures and their derivatives) are provided via Vertex2FTPropertyMap concepts, while 3d vector data (principal directions of curvatures) are provided via Vertex2VectorPropertyMap concepts. The rationale for introducing these concepts is that properties are used independently from the way they are stored. This enables the user to store them internally in extended vertices or externally with maps. We provide a class Vertex2Data_Property_Map_with_std_map to adapt std::map with a boost::associative_property_map to model these concepts.
Output of ridges or umbilics are provided via output iterator.
Approximation of ridges and umbilics are performed by two independent classes, which we now further describe.
The main class is Ridge_approximation<TriangulatedSurfaceMesh,Vertex2FTPropertyMap,Vertex2VectorPropertyMap>. Its construction requires the mesh and the property maps defining the differential quantities for principal curvatures k1 and k2, the third order extremalities b0 and b3, the principal directions of curvature d1 and d2, and the fourth order quantities P1 and P2 if the tagging of ridges as elliptic or hyperbolic is to be done using the polynomials P1 and P2.
Three functions (provided as members and also as global functions) enable the computation of different types of ridges :
These functions allows the user to specify how the elliptic/hyperbolic
tagging is carried out.
Notice the rationale for the choice of these three functions is
simple: each computation needs a single pass over the triangles of the
mesh. This should be clear for the min and max ridges. For crests,
just notice max and min crests cannot intersect over a triangle.
The ridge lines are stored in Ridge_line objects and output through an iterator. Each ridge line is represented as a list of halfedges of the mesh it crosses with a scalar defining the barycentric coordinate of the crossing point with respect to the half-egde endpoints. Each ridge line comes with its type Ridge_type, its strength and sharpness.
If one chooses to use only third order quantities, the quantities Pi do not have to be defined. Then the sharpness will not be defined.
Umbilics are stored in Umbilic objects, they come with their type : ELLIPTIC_UMBILIC, HYPERBOLIC_UMBILIC or NON_GENERIC_UMBILIC; the vertex of the mesh they are associated to and the list of half-edges representing the contour of the neighborhood.
#include <CGAL/Ridges.h> #include <CGAL/Umbilics.h> //this is an enriched Polyhedron with facets' normal #include "PolyhedralSurf.h" typedef PolyhedralSurf::Traits Kernel; typedef Kernel::FT FT; typedef Kernel::Point_3 Point_3; typedef Kernel::Vector_3 Vector_3; typedef PolyhedralSurf::Vertex_const_handle Vertex_const_handle; typedef PolyhedralSurf::Vertex_const_iterator Vertex_const_iterator; typedef CGAL::Vertex2Data_Property_Map_with_std_map<PolyhedralSurf> Vertex2Data_Property_Map_with_std_map; typedef Vertex2Data_Property_Map_with_std_map::Vertex2FT_map Vertex2FT_map; typedef Vertex2Data_Property_Map_with_std_map::Vertex2Vector_map Vertex2Vector_map; typedef Vertex2Data_Property_Map_with_std_map::Vertex2FT_property_map Vertex2FT_property_map; typedef Vertex2Data_Property_Map_with_std_map::Vertex2Vector_property_map Vertex2Vector_property_map; //RIDGES typedef CGAL::Ridge_line<PolyhedralSurf> Ridge_line; typedef CGAL::Ridge_approximation < PolyhedralSurf, back_insert_iterator< std::vector<Ridge_line*> >, Vertex2FT_property_map, Vertex2Vector_property_map > Ridge_approximation; //UMBILICS typedef CGAL::Umbilic<PolyhedralSurf> Umbilic; typedef CGAL::Umbilic_approximation < PolyhedralSurf, back_insert_iterator< std::vector<Umbilic*> >, Vertex2FT_property_map, Vertex2Vector_property_map > Umbilic_approximation; //create property maps Vertex2FT_map vertex2k1_map, vertex2k2_map, vertex2b0_map, vertex2b3_map, vertex2P1_map, vertex2P2_map; Vertex2Vector_map vertex2d1_map, vertex2d2_map; Vertex2FT_property_map vertex2k1_pm(vertex2k1_map), vertex2k2_pm(vertex2k2_map), vertex2b0_pm(vertex2b0_map), vertex2b3_pm(vertex2b3_map), vertex2P1_pm(vertex2P1_map), vertex2P2_pm(vertex2P2_map); Vertex2Vector_property_map vertex2d1_pm(vertex2d1_map), vertex2d2_pm(vertex2d2_map); int main(int argc, char *argv[]) { //compute differential quantities with the jet fitting package ... //initialize the property maps ... //--------------------------------------------------------------------------- //Ridges //-------------------------------------------------------------------------- Ridge_approximation ridge_approximation(P, vertex2k1_pm, vertex2k2_pm, vertex2b0_pm, vertex2b3_pm, vertex2P1_pm, vertex2P2_pm, vertex2d1_pm, vertex2d2_pm); std::vector<Ridge_line*> ridge_lines; back_insert_iterator<std::vector<Ridge_line*> > ii(ridge_lines); //Find MAX_RIDGE, MIN_RIDGE, CREST or all ridges ridge_approximation.compute_max_ridges(ii, tag_order); ridge_approximation.compute_min_ridges(ii, tag_order); ridge_approximation.compute_crest_ridges(ii, tag_order); //--------------------------------------------------------------------------- // UMBILICS //-------------------------------------------------------------------------- Umbilic_approximation umbilic_approximation(P, vertex2k1_pm, vertex2k2_pm, vertex2d1_pm, vertex2d2_pm); std::vector<Umbilic*> umbilics; back_insert_iterator<std::vector<Umbilic*> > umb_it(umbilics); umbilic_approximation.compute(umb_it, umb_size); }
For Figure56.5, the data have been computed as follows:
./Compute_Ridges_Umbilics -f data/ellipsoid_u_0.02.off -d 4 -m 4 -a 3 -t 3In addition, the four elliptic umbilics are detected, the standard output being
nb of umbilics 4 Umbilic at location (-0.80899 0.00426003 0.293896) of type elliptic Umbilic at location (-0.811197 0.0122098 -0.292259) of type elliptic Umbilic at location (0.808372 -0.00551307 -0.29431) of type elliptic Umbilic at location (0.81413 0.0018689 0.290339) of type elliptic
Figure 56.6 illustrates the filtering of crest ridges on a mechanical model, and has been computed as follows:
./Compute_Ridges_Umbilics -f data/mecanic.off -d 4 -m 4 -a 4 -t 4
1 | Notations b0, b3 comes from Equation 56.2 |
2 | A marching triangles algorithm is similar to a 2d marching cubes algorithm (or marching rectangles algorithm), except that a one-manifold is reported on a two-manifold tessellated by triangles. |
3 | Model data may be downloaded via ftp://ftp.mpi-sb.mpg.de/pub/outgoing/CGAL/Ridges_3_datafiles.tgz . The mechanical part model has been provided courtesy of Dassault System to produce Figure 56.6, due to copyright issues the available model is not the same, it is provided by the AIM@SHAPE Shape Repository. |